<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="mainbar">
	<div class="page-head">
		<h2 class="pull-left">
			<i class="icon-table"></i>
			<spring:message code="menu.listNews.label" />
		</h2>
		<div class="clearfix"></div>
	</div>
	<div class="matter">
		<div class="container-fluid">
			<!-- Table -->
			<div class="row-fluid">
				<div class="span12">
					<div class="widget">
						<div class="widget-head">
							<div class="pull-left">
								<spring:message code="menu.listNews.label" />
							</div>
							<div class="pull-right">
								<a href="${pageContext.request.contextPath}/admin/getAddNews"
									class="btn btn-mini btn-success"> <i class="icon-pencil"></i>
									<spring:message code="menu.addNews.label" /></a>
							</div>
							<div class="clearfix"></div>
						</div>
						<div class="widget-content">
							<table id="adminTable"
								class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th style="width: 20px">#</th>
										<th style="min-width: 100px; max-width: 250px"><spring:message
												code="menu.newsname.label" /></th>
										<th style="min-width: 100px; max-width: 250px"><spring:message
												code="menu.newsimage.label" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="menu.newsshortdesc.label" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.processdate" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.user" /></th>
										<th><spring:message code="menu.isActive.label" /></th>
										<th style="width: 100px"><spring:message
												code="menu.control.label" /></th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${newsList}" var="news" varStatus="count">
										<tr>
											<td>${count.count}</td>
											<td><c:out value="${news.name}" /></td>
											<td><img src="../resources/news-images/${news.image}"
												style="width: 50px; height: 50px" /></td>
											<td><c:out value="${news.shortdescvi}" /></td>
											<td><c:out value="${news.processDate}" /></td>
											<td><c:out value="${news.user}" /></td>
											<td><c:choose>
													<c:when test="${news.isActive == true}">
														<a id="showbutton${news.id}" style="width: 3px;"
															onclick="return confirmDeactive('News', ${news.id});">Hiển
															Thị</a>
													</c:when>
													<c:otherwise>
														<a id="showbutton${news.id}" style="width: 3px;"
															onclick="return confirmDeactive('News', ${news.id});">Không
															Hiển Thị</a>
													</c:otherwise>
												</c:choose></td>
											<td>
												<form action="getUpdateNews" method="get"
													style="width: 50px; float: left">
													<button type="submit" class="btn btn-mini btn-warning">
														<i class="icon-pencil"></i>
														<spring:message code="menu.edit.label" />
													</button>
													<input type="hidden" value="${news.id}" name="newsId">
												</form>
												<button class="btn btn-mini  btn-danger"
													onclick="confirmDelete('News', ${news.id})">
													<i class="icon-pencil"></i>
													<spring:message code="menu.delete.label" />
												</button>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
						<div class="widget-foot"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>